You might need to wait a few seconds for all of the graphics in this file to load.
You import a mapfile from a built-in example file, a local excel
file, from a S3 store, or from sql using load_mapfile()
A family of functions pipe_* are provided (manipulate,
calculate, hide, combine…) to implement successive filtering operations
on a mapfile. These operations do not change the underlying data.
So you import/load data as a mapfile and all your work steps are then just applying successive filters.
Each filter returns another mapfile, suitably filtered.
Mapfiles, which are just lists of tables (actually,
tibbles) with the class mapfile.
Statement tables are used in Causal Map as the underlying data which is to be coded into causal links. So each link refers to a quote from a particular statement. Statements are optional and this package can be used without them.
In this package, nodes are called factors and the edges
are called links.
All of these filters can be produced and edited either in a chain of
actual R functions or in the simplified text format which is processed
by the parser: parse_commands.
This parser takes text strings with a simpler command syntax as input and outputs one of these main functions for each line of text. This parser is used to read text commands from the input window in Causal Map Viewer and manipulate the output map with the corresponding functions. The input text can also consist of several lines, and the commands are applied one by one in sequence, in a pipeline of commands, such that after each command, such as each command starts with the map defined by the previous line and produces a new one.
There are three output functions which are thin wrappers around visNetwork, DiagrammeR and DT, allowing a graph to be displayed using any of these three visualisation engines.
Some of the commands such as path tracing create additional fields or variables for each factor and/or link. For example, when filtering by label, fields are created which can then be used to apply formatting.
(After loading CausalMapFunctions library)
The package ships with some example datasets, at the moment just these:
which you can also view in Causal Map on the web.
Visualise the files like this:
example2 %>% pipe_coerce_mapfile() %>% make_interactive_map
Your input mapfile should have the standard Causal Map format: you can see an example by downloading any of the files in Causal Map on the web.
pipe_coerce_mapfile will also process a file with no
factors and from_label and to_label columns as a named edgelist.
factor ids are no longer contiguous, pipe normalise factors links now just deletes links with no factors.
# ll <- quip_example
# ee <- example2
ee <- load_mapfile("example2") %>% pipe_recalculate_all()
xtitle <- "Interactive"
xdescription <- ""
ee %>%
pipe_label_links("link_id",fun = "unique") %>%
make_interactive_map
xtitle <- "Print"
ee %>%
pipe_label_links("link_id",fun = "unique") %>%
make_print_map()
xdescription <- "Set a different print layout"
ee %>%
pipe_set_print(grv_layout="circo") %>%
make_print_map()
ef <- load_mapfile("example-file")%>% pipe_coerce_mapfile
hz <- load_mapfile("health-zoom")%>% pipe_coerce_mapfile
cg <- load_mapfile("oicanadaghana22")%>% pipe_coerce_mapfile
sz <- load_mapfile("smartzoomingexample")%>% pipe_coerce_mapfile
kh <- load_mapfile("kantar-hierarchy-test-sp")%>% pipe_coerce_mapfile
ks <- load_mapfile("kantar-swan-short")%>% pipe_coerce_mapfile
so <- load_mapfile("stress-opposites")%>% pipe_coerce_mapfile
tt <- load_mapfile("tearfund-sl-small")%>% pipe_coerce_mapfile
ll <- load_mapfile("quip-coded")%>% pipe_coerce_mapfile
oi <- load_mapfile("2oirefugeetestimonies")%>% pipe_coerce_mapfile
oo <- load_mapfile("organisation1coded")%>% pipe_coerce_mapfile
e3 <- load_mapfile("example3-path-tracing")%>% pipe_coerce_mapfile
mm <- load_mapfile("save-the-children-mozambique-copy")%>% pipe_coerce_mapfile
hh <- load_mapfile("hannahcombiningopposites-sp-test")%>% pipe_coerce_mapfile
oi <- load_mapfile("2oirefugeetestimonies")%>% pipe_coerce_mapfile
oh <- load_mapfile("oh1-sp2")%>% pipe_coerce_mapfile
cc <- load_mapfile("coded-quip-training")%>% pipe_coerce_mapfile
de <- load_mapfile("dimensions-example")%>% pipe_coerce_mapfile
ma <- load_mapfile("concern-2022-malawi")%>% pipe_coerce_mapfile
pa <- load_mapfile("pilotabcdwellbeing-2022")%>% pipe_coerce_mapfile
oig <- load_mapfile("oi-2021-ghana")%>% pipe_coerce_mapfile
# ef %>% parse_commands("zoom factors level=1
# find factors field=factor_memo value=Agriculture operator=contains up=0 down=0
# ") %>%
# make_mentions_tabl() %>%
# pull(`#Name of province`) %>%
# table(useNA = "al")
If you filter the factors of a mapfile, e.g. show only factors with labels beginning xyz,
If you filter the links of a mapfile, e.g. show only links with hashtags containing xyz,
If you filter the statements of a mapfile, e.g. show only statements with texts containing xyz,
ll %>%
pipe_select_factors(15) %>%
make_interactive_map
ll %>%
pipe_select_factors(15) %>%
make_interactive_map
Simple frequency
ll %>%
pipe_find_links("simple_frequency",value = 50,"greater") %>%
make_interactive_map
ll %>%
pipe_select_links(5) %>%
make_interactive_map
ll %>%
pipe_find_statements(field="statement_id",value=5,operator="equals") %>%
make_interactive_map
ee %>%
pipe_find_factors(field="factor_memo",value="memo",operator="equals") %>%
make_interactive_map
ll %>%
pipe_find_factors(value="economic") %>%
make_interactive_map
If you don’t want to show interlinks between downstream factors, use
find links instead.
oo %>%
pipe_find_factors(value="more/better seeds",up=0,down=1,remove_isolated = T) %>%
pipe_bundle_links() %>%
make_print_map
oo %>%
pipe_find_links(value="more/better seeds",field="from_label",operator="contains") %>%
pipe_bundle_links() %>%
make_print_map
ee %>%
pipe_find_factors(value="rainfall",up=0,down=0,remove_isolated = T) %>%
make_interactive_map
ee %>%
pipe_find_factors(value="rainfall",up=0,down=0,remove_isolated = F) %>%
make_interactive_map
ee %>%
pipe_find_factors(value="business") %>%
make_interactive_map
ee %>%
pipe_find_factors(value="sea",operator="notcontains") %>%
make_interactive_map
ee %>% pipe_find_statements(value="1",operator="notcontains",field="statement_id")%>%
make_interactive_map
ee %>% pipe_find_statements(value="1",operator="notcontains",field="statement_id")%>%
make_interactive_map
ee %>% pipe_find_statements(value="1",operator="notequals",field="statement_id")%>%
make_interactive_map
ee %>%
pipe_find_factors(value="Coastal erosion",operator="notequals") %>%
make_interactive_map
Does not work in functions, but works when parsed:
ee %>%
pipe_find_factors(value="business OR property") %>%
make_interactive_map
ee %>%
parse_commands("find factors field=label operator=contains value=Business OR Property") %>%
make_interactive_map
Order matters
ll %>%
pipe_find_factors(value="economic") %>%
pipe_select_factors(5) %>%
make_interactive_map
No result
ll %>%
pipe_find_factors(value="asdfasdfasdf") %>%
make_interactive_map
ll %>%
pipe_find_links(field="from_label",value="economic",operator="contains") %>%
make_interactive_map
ll %>%
pipe_find_statements(field="statement_id",value=20,operator="less") %>%
make_interactive_map
No result
ll %>%
pipe_find_statements(field="statement_id",value=20000000,operator="greater") %>%
make_interactive_map
e3 %>%
pipe_find_factors(value="Damage",highlight_only=T) %>% pipe_color_factors(field="found") %>%
make_interactive_map()
Note this doesn’t work in the app:
e3 %>%
pipe_find_links(field="from_label",value="Damage",highlight_only=T) %>%
pipe_color_links(field="found",fun="literal") %>%
make_interactive_map()
pipe_cluster_sources(oi)
## $factors
## # A tibble: 76 × 31
## label level_1_label level_2_label factor_memo driver_score outcome_score
## <chr> <chr> <chr> <chr> <dbl> <dbl>
## 1 "\U0001f3… "\U0001f308 … <NA> <NA> -16 -4
## 2 "⇧ Starte… "⇧ Started s… " goats" <NA> -1 -1
## 3 "⇧ OBUL c… "⇧ OBUL cash… <NA> <NA> -4 2
## 4 "⇧ Opened… "⇧ Opened sa… <NA> <NA> -9 3
## 5 "⇧ Repayi… "⇧ Repaying … <NA> <NA> -2 1
## 6 "⇧ Use mo… "⇧ Use money… <NA> <NA> -2 1
## 7 "Victim o… "Victim of c… " police int… <NA> 2 -4
## 8 "Forced t… "Forced to f… <NA> <NA> -10 -10
## 9 "Living i… "Living in r… <NA> <NA> 0 -30
## 10 "Given fo… "Given food,… <NA> <NA> -7 2
## # … with 66 more rows, and 25 more variables: driver_rank <int>,
## # outcome_rank <int>, is_opposable <lgl>, top_level_label <chr>,
## # top_level_frequency <dbl>, map_id <int>, size <int>, betweenness <dbl>,
## # betweenness_rank <int>, in_degree <dbl>, out_degree <dbl>, frequency <dbl>,
## # is_flipped <lgl>, zoom_level <dbl>, role <dbl>,
## # betweenness_rank_reversed <dbl>, frequency_rank <int>,
## # frequency_rank_reversed <dbl>, driver_rank_reversed <dbl>, …
##
## $links
## # A tibble: 144 × 37
## from_label to_label statement_id quote simple_bundle from to
## <chr> <chr> <int> <chr> <chr> <int> <int>
## 1 "Living in refugee set… "Given … 1 "Whe… "Living in r… 12 13
## 2 "Forced to flee" "Living… 1 "Whe… "Forced to f… 10 12
## 3 "Grow business" "\U0001… 1 "Las… "Grow busine… 19 20
## 4 "Need more; to provide… "\U0001… 1 "Whe… "Need more; … 21 20
## 5 "\U0001f308 Grow busin… "OI Fin… 1 "I s… "\U0001f308 … 20 22
## 6 "OI Financial diary" "Improv… 1 "I s… "OI Financia… 22 23
## 7 "OI Financial diary" "\U0001… 1 "My … "OI Financia… 22 25
## 8 "OI Financial diary" "⇧ Open… 2 "Gen… "OI Financia… 22 6
## 9 "OI Financial diary" "⇧ OBUL… 2 "Gen… "OI Financia… 22 5
## 10 "\U0001f308 Grow busin… "\U0001… 1 "If … "\U0001f308 … 20 2
## # … with 134 more rows, and 30 more variables: actualisation <int>,
## # strength <int>, certainty <int>, link_label <chr>, hashtags <chr>,
## # link_memo <chr>, link_id <int>, capacity <dbl>, weight <int>,
## # from_flipped <lgl>, to_flipped <lgl>, map_id <int>, simple_frequency <int>,
## # source_frequency <int>, before_id <list>, after_id <list>, text <chr>,
## # statement_memo <chr>, statement_map_id <dbl>, source_id <chr>,
## # source <chr>, Country <chr>, Sex <chr>, source_memo <chr>, …
##
## $statements
## # A tibble: 16 × 15
## text statement_memo statement_map_id statement_id source_id source Country
## <chr> <chr> <dbl> <dbl> <chr> <chr> <chr>
## 1 "I lef… <NA> 1 1 Gentil Testi… Burundi
## 2 "Genti… <NA> 1 2 Gentil Testi… Burundi
## 3 "I am … <NA> 1 3 Mary Testi… Burundi
## 4 "I hav… <NA> 1 4 Fatuma Testi… Somalia
## 5 "I am … <NA> 1 5 Swedi Testi… Congo
## 6 "Swedi… <NA> 1 6 Swedi Testi… Congo
## 7 "I am … <NA> 1 7 Bitalie Testi… Congo
## 8 "Bital… <NA> 1 8 Bitalie Testi… Congo
## 9 "I cam… <NA> 1 9 Odeta Testi… Burundi
## 10 "Odete… <NA> 1 10 Odeta Testi… Burundi
## 11 "I am … <NA> 1 11 Kakule Testi… Congo
## 12 "Kakul… <NA> 1 12 Kakule Testi… Congo
## 13 "I hav… <NA> 1 13 Charlotte Testi… Burundi
## 14 "I am … <NA> 1 14 Zainabu Testi… Burundi
## 15 "I cam… <NA> 1 15 Therese Testi… Congo
## 16 "There… <NA> 1 16 Therese Testi… Congo
## # … with 8 more variables: Sex <chr>, source_memo <chr>, source_map_id <dbl>,
## # `#unfiltered_cluster_set_2` <chr>, question_id <chr>, question_text <chr>,
## # question_memo <chr>, question_map_id <dbl>
##
## $sources
## # A tibble: 10 × 7
## source_id source Country Sex source_memo source_map_id `#unfiltered_c…`
## <chr> <chr> <chr> <chr> <chr> <dbl> <chr>
## 1 Gentil Testimony Burundi Male global sou… 1 b
## 2 Mary Testimony Burundi Female global sou… 1 b
## 3 Fatuma Testimony Somalia Female global sou… 1 b
## 4 Swedi Testimony Congo Male global sou… 1 b
## 5 Bitalie Testimony Congo Female global sou… 1 b
## 6 Odeta Testimony Burundi Female global sou… 1 a
## 7 Kakule Testimony Congo Male global sou… 1 b
## 8 Charlotte Testimony Burundi Female global sou… 1 b
## 9 Zainabu Testimony Burundi Female global sou… 1 b
## 10 Therese Testimony Congo Female global sou… 1 b
##
## $questions
## # A tibble: 1 × 4
## question_id question_text question_memo question_map_id
## <chr> <chr> <chr> <dbl>
## 1 1 global question <NA> 1
##
## $settings
## # A tibble: 1 × 3
## setting_id value map_id
## <chr> <chr> <chr>
## 1 background_colour <NA> 1
##
## attr(,"info")
## attr(,"info")$load_mapfile
## attr(,"info")$load_mapfile$graf
## [1] ""
##
## attr(,"info")$load_mapfile[[2]]
## load_mapfile path=2oirefugeetestimonies
##
##
## attr(,"info")$pipe_recalculate_factors
## attr(,"info")$pipe_recalculate_factors[[1]]
## pipe_recalculate_factors
##
## attr(,"info")$pipe_recalculate_factors$graf
## .
##
##
## attr(,"info")$pipe_recalculate_links
## attr(,"info")$pipe_recalculate_links[[1]]
## pipe_recalculate_links
##
## attr(,"info")$pipe_recalculate_links$graf
## .
oi %>%
pipe_find_factors(value="Take a loan",up = 1,down=1) %>%
make_mentions_tabl()
## # A tibble: 96 × 70
## link_id label direction mentions level_1_label level_2_label factor_memo
## <int> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 10 "\U0001f3… conseque… any "\U0001f308 … <NA> <NA>
## 2 11 "\U0001f3… conseque… any "\U0001f308 … <NA> <NA>
## 3 69 "\U0001f3… conseque… any "\U0001f308 … <NA> <NA>
## 4 80 "\U0001f3… conseque… any "\U0001f308 … <NA> <NA>
## 5 83 "\U0001f3… conseque… any "\U0001f308 … <NA> <NA>
## 6 86 "\U0001f3… conseque… any "\U0001f308 … <NA> <NA>
## 7 89 "\U0001f3… conseque… any "\U0001f308 … <NA> <NA>
## 8 93 "\U0001f3… conseque… any "\U0001f308 … <NA> <NA>
## 9 97 "\U0001f3… conseque… any "\U0001f308 … <NA> <NA>
## 10 116 "\U0001f3… conseque… any "\U0001f308 … <NA> <NA>
## # … with 86 more rows, and 63 more variables: driver_score <dbl>,
## # outcome_score <dbl>, driver_rank <int>, outcome_rank <int>,
## # is_opposable <lgl>, top_level_label <chr>, top_level_frequency <dbl>,
## # size <int>, betweenness <dbl>, betweenness_rank <int>, in_degree <dbl>,
## # out_degree <dbl>, frequency <dbl>, is_flipped <lgl>, zoom_level <dbl>,
## # role <dbl>, betweenness_rank_reversed <dbl>, frequency_rank <int>,
## # frequency_rank_reversed <dbl>, driver_rank_reversed <dbl>, …
oi %>%
pipe_find_factors(value="Take a loan",up = 1,down=1) %>%
.$factors %>% select(label,source_count)
## # A tibble: 11 × 2
## label source_count
## <chr> <int>
## 1 "\U0001f308 Take a loan" 8
## 2 "\U0001f308 Grow business" 3
## 3 "Need more; to provide for family" 3
## 4 "OI Financial diary" 4
## 5 "\U0001f308 Set up a business" 1
## 6 "⇧ Improved financial mgt" 1
## 7 "\U0001f308 Set up a business; build houses" 1
## 8 "Cannot grow business" 3
## 9 "Started small business; tailor" 1
## 10 "\U0001f308 Set up a business;shop" 2
## 11 "\U0001f308 Regenerate business #coping" 2
ll %>%
pipe_select_factors(5) %>%
pipe_scale_factors(field="frequency") %>%
make_interactive_map
ll %>%
pipe_select_factors(5) %>%
pipe_color_text(field="frequency") %>%
make_interactive_map
ll %>%
pipe_select_factors(5) %>%
pipe_scale_factors(field="frequency") %>%
make_print_map
ll %>%
pipe_select_factors(5) %>%
pipe_color_factors(field="frequency") %>%
pipe_color_borders(field="betweenness") %>%
pipe_wrap_factors(5) %>%
make_interactive_map
ll %>%
pipe_select_factors(5) %>%
pipe_color_links(value="count: link_id") %>%
pipe_wrap_factors(5) %>%
make_interactive_map
ll %>%
pipe_select_factors(5) %>%
pipe_color_links(value="count: link_id") %>%
pipe_wrap_factors(5) %>%
make_print_map
ee %>%
pipe_label_links("from_label",fun = "unique") %>%
pipe_wrap_links(6) %>%
make_interactive_map
ee %>%
pipe_label_links("from_label",fun = "unique") %>%
pipe_wrap_links(6) %>%
make_print_map
ee %>%
pipe_label_links(value="unique: from_label") %>%
pipe_wrap_links(6) %>%
make_interactive_map
ll %>%
make_interactive_map
ll %>%
pipe_select_factors(5) %>%
pipe_remove_brackets() %>%
make_interactive_map
ks %>%
parse_commands("find factors field=label value=~People feeling safe operator=notcontains up=4 down=1
find factors field=label value=People feeling safe operator=contains up=4 down=1
zoom factors level=2
remove isolated
find links field=source_frequency value=2 operator=greater
remove selfloops
hide quickfields
bundle links field=simple_bundle
label factors field=source_count add_field_name=FALSE clear_previous=FALSE
scale links value=count: source_id
label links value=count: source_id
wrap factors length=40
color text field=is_opposable lo=black hi=#f26d04
color factors field=found lo=white hi=#7FC97F") %>%
make_print_map()
## NULL
ef %>%
parse_commands("find factors field=label value=Health=contains up=4 down=1
zoom factors level=2
remove isolated
find links field=source_frequency value=2 operator=greater
remove selfloops
hide quickfields
bundle links field=simple_bundle
label factors field=source_count add_field_name=FALSE clear_previous=FALSE
scale links value=count: source_id
label links value=count: source_id
wrap factors length=40
color text field=is_opposable lo=black hi=#f26d04
color factors field=found lo=white hi=#7FC97F") %>%
make_print_map()
ll %>%
pipe_bundle_factors(value = "IEA") %>%
pipe_select_factors(5) %>%
make_interactive_map
ee %>%
pipe_color_links("link_id",fun = "mean") %>%
make_interactive_map
ee %>%
pipe_scale_links("link_id",fun = "mean") %>%
make_interactive_map
cc %>%
pipe_find_factors(value="Improved health") %>%
# pipe_zoom_factors(1) %>%
pipe_select_factors(top=10) %>%
pipe_bundle_links(field="simple_bundle") %>%
pipe_label_links(field="source_id",fun = "count") %>%
pipe_label_factors(field="source_count",add_field_name = F) %>%
pipe_wrap_factors() %>%
make_print_map
cc %>%
pipe_find_factors(value="Improved health") %>%
# pipe_zoom_factors(1) %>%
pipe_select_factors(top=10) %>%
pipe_bundle_links(field="simple_bundle") %>%
pipe_label_links(field="source_id",fun = "count") %>%
pipe_label_factors(field="source_count",add_field_name = T) %>%
pipe_wrap_factors() %>%
make_print_map
oo %>%
pipe_select_factors(5) %>%
pipe_bundle_links(("#Name of village") ) %>%
pipe_label_links(field = "#Name of village",fun="unique") %>%
make_interactive_map
oo %>%
pipe_select_factors(5) %>%
pipe_bundle_links(("vill") ) %>%
pipe_label_links(field = "#Name of village",fun="unique") %>%
make_interactive_map
e3 %>%
pipe_label_links("link_id",fun = "literal") %>%
pipe_label_links("from_label",fun = "literal",add_field_name = T,clear_previous = F) %>%
make_interactive_map
e3 %>%
pipe_bundle_links() %>%
pipe_label_links("link_id",fun = "literal",add_field_name = T) %>%
make_interactive_map
e3 %>%
pipe_bundle_links() %>%
pipe_label_links("link_id",fun = "literal") %>%
pipe_label_links("from_label",fun = "literal",clear_previous = F) %>%
make_interactive_map
e3 %>%
pipe_bundle_links() %>%
parse_commands("label links field=statement_id fun=unique clear_previous=F") %>%
make_interactive_map
Note the defaults for bundle_links and
label_links:
oo %>%
pipe_select_factors(5) %>%
pipe_bundle_links(("#Name of province") ) %>%
pipe_label_links(("#Name of province") ) %>%
make_interactive_map
oo %>%
parse_commands("
select links top=15
select factors top=10
bundle links field=#2
label factors field=frequency add_field_name=FALSE clear_previous=FALSE
scale links value=count: link_id
label links field=#2Name of village fun=unique add_field_name=FALSE clear_previous=TRUE
color text field=is_opposable lo=black hi=#f26d04") %>%
make_interactive_map
oo %>%
pipe_select_factors(5) %>%
pipe_bundle_links("village" ) %>%
pipe_label_links("village" ,fun = "unique" ) %>%
make_interactive_map
ll %>%
pipe_find_factors(value="economic") %>%
pipe_select_factors(5) %>%
pipe_bundle_links() %>%
pipe_label_links() %>%
make_interactive_map
ll %>%
pipe_find_factors(value="economic") %>%
pipe_select_factors(5) %>%
pipe_bundle_links() %>%
pipe_label_links() %>%
make_interactive_map
Note the default for bundle_links is equivalent to
simple_bundle:
ll %>%
pipe_find_factors(value="economic") %>%
pipe_select_factors(5) %>%
pipe_bundle_links(group="simple_bundle") %>%
pipe_label_links() %>%
make_interactive_map
ll %>%
pipe_select_factors(5) %>%
pipe_bundle_links(field="1. Sex") %>%
pipe_scale_links("link_id",fun = "count") %>%
pipe_label_links("1. Sex",fun = "unique") %>%
pipe_color_links("1. Sex",fun = "unique") %>%
make_interactive_map
ll %>%
pipe_select_links(16) %>%
pipe_bundle_links(field="1. Sex") %>%
pipe_label_links("link_id",fun = "count") %>%
make_interactive_map
ll %>%
pipe_select_factors(5) %>%
pipe_bundle_links(field="1. Sex") %>%
pipe_color_links("link_id",fun = "count") %>%
pipe_scale_links("link_id",fun = "count") %>%
pipe_label_links("link_id",fun = "count") %>%
make_interactive_map
ll %>%
pipe_find_factors(value="sed yield") %>%
pipe_bundle_links(field="District") %>%
pipe_color_links(field="District",fun="unique") %>%
pipe_label_links(value="percent: link_id") %>%
pipe_scale_links(field="link_id",fun="count") %>%
make_print_map
ll %>%
pipe_find_factors(value="sed yield") %>%
pipe_bundle_links(field="1. Sex") %>%
pipe_color_links(field="1. Sex",fun="unique") %>%
pipe_label_links(field="link_id",fun="percent") %>%
pipe_scale_links(field="link_id",fun="count") %>%
make_print_map
ll %>%
pipe_find_factors(value="sed yield") %>%
pipe_bundle_links(field="1. Sex") %>%
pipe_color_links(field="1. Sex",fun="unique") %>%
pipe_label_links(field="source_id",fun="percent") %>%
pipe_scale_links(field="source_id",fun="percent") %>%
make_print_map
ll %>%
pipe_find_factors(value="sed yield",down=0) %>%
pipe_bundle_links(field="1. Sex") %>%
pipe_color_links(field="source_id",fun="percent") %>%
pipe_label_links(field="source_id",fun="percent") %>%
pipe_scale_links(field="source_id",fun="count") %>%
make_print_map
ll %>%
pipe_find_factors(value="sed yield",down=0) %>%
pipe_bundle_links(field="1. Sex") %>%
pipe_color_links(field="1. Sex",fun="unique") %>%
pipe_label_links(field="source_id",fun="surprise") %>%
pipe_scale_links(field="source_id",fun="count") %>%
make_print_map
ll %>%
pipe_find_factors(value="sed yield",down=0) %>%
pipe_bundle_links(field="1. Sex") %>%
pipe_label_links(field="1. Sex",fun="unique") %>%
pipe_color_links(field="source_id",fun="surprise") %>%
pipe_scale_links(field="source_id",fun="count") %>%
make_print_map
oo %>%
pipe_find_factors(value="crops",down=0) %>%
pipe_bundle_links(field="#4Sex of the respondent") %>%
pipe_label_links(field="#4Sex of the respondent",fun="initials") %>%
pipe_color_links(field="source_id",fun="surprise") %>%
pipe_scale_links(field="source_id",fun="count") %>%
make_print_map
oh %>%
pipe_select_factors(10) %>%
pipe_bundle_links(field="simple_bundle") %>%
pipe_label_links(field="from_label",fun="initials") %>%
make_print_map
Shouldn’t make any difference as factor and link fields are now recalculated after every transform; but beforeids and afterids are added only on load_mapfile.
ll %>%
pipe_find_factors(value="WASH") %>%
pipe_color_factors(field="betweenness") %>%
make_interactive_map
ll %>%
pipe_find_factors(value="WASH") %>%
pipe_recalculate_factors() %>%
pipe_color_factors(field="betweenness") %>%
make_interactive_map
so %>%
pipe_label_links(field = "source_id",fun="literal") %>%
pipe_mark_links(field="source_id") %>%
make_print_map
e3 %>%
pipe_label_links(field = "source_id",fun="literal") %>%
pipe_mark_links(field="source_id") %>%
make_print_map
ee %>%
pipe_label_links(field = "source_id",fun="literal") %>%
pipe_mark_links(field="source_id") %>%
make_print_map
so %>%
pipe_bundle_links(field = "source_id") %>%
pipe_label_links(field = "source_id",fun="literal") %>%
pipe_mark_links(field="source_id") %>%
make_print_map
so %>%
pipe_combine_opposites() %>%
pipe_bundle_links(field = "flipped_bundle") %>%
pipe_label_links(field = "source_id",fun="literal") %>%
pipe_mark_links(field="source_id") %>%
make_print_map
ll %>%
pipe_select_factors(5) %>%
pipe_bundle_links(field = "simple_bundle") %>%
pipe_mark_links(field="source_id") %>%
make_print_map
#original:
so %>%
pipe_label_links(field = "source_id",fun="unique") %>%
make_print_map
so %>%
pipe_label_links(field = "source_id",fun="unique") %>%
pipe_show_continuity(field="source_id",type="label") %>%
make_print_map
so %>%
pipe_label_links(field = "source_id",fun="unique") %>%
pipe_show_continuity(field="source_id") %>%
make_print_map
ee %>%
pipe_label_links(field = "source_id",fun="unique") %>%
pipe_show_continuity(field="source_id") %>%
make_print_map
e3 %>%
pipe_label_links(field = "source_id",fun="unique") %>%
pipe_show_continuity(field="source_id") %>%
make_print_map
e3 %>%
pipe_zoom_factors() %>%
pipe_show_continuity(field="source_id") %>%
pipe_label_links(field = "source_id",fun="unique") %>%
make_print_map
e3 %>%
pipe_bundle_factors("Flooding") %>%
pipe_show_continuity(field="source_id") %>%
pipe_label_links(field = "source_id",fun="unique") %>%
make_print_map
e3 %>%
pipe_bundle_factors("Flooding") %>%
pipe_bundle_links(field = "source_id") %>%
pipe_label_links(field = "source_id",fun="literal") %>%
pipe_show_continuity(field="source_id") %>%
make_print_map
so %>%
pipe_bundle_links() %>%
pipe_label_links(field = "source_id",fun="unique") %>%
pipe_show_continuity(field="source_id") %>%
make_print_map
so %>%
pipe_combine_opposites() %>%
pipe_label_links("link_id","literal") %>%
pipe_show_continuity(field="source_id") %>%
make_print_map
so %>%
pipe_combine_opposites() %>%
pipe_show_continuity() %>%
make_print_map
so %>%
pipe_combine_opposites() %>%
pipe_bundle_links(field = "flipped_bundle") %>%
pipe_show_continuity(field="source_id") %>%
pipe_label_links(field = "source_id",fun="unique") %>%
make_print_map
# Order should not matter, but you can't put bundle links later
so %>%
pipe_combine_opposites() %>%
pipe_show_continuity(field="source_id") %>%
pipe_bundle_links(field = "flipped_bundle") %>%
pipe_label_links(field = "source_id",fun="unique") %>%
make_print_map
ll %>%
pipe_select_factors(5) %>%
pipe_bundle_links(field = "simple_bundle") %>%
pipe_scale_links(field = "link_id",fun="count") %>%
pipe_show_continuity(field="source_id") %>%
make_print_map
hz %>%
pipe_show_continuity(field="source_id") %>%
make_print_map
hz %>%
pipe_zoom_factors(1) %>%
pipe_show_continuity(field="source_id") %>%
make_print_map
Group and label by sex and scale by count:
ll %>%
pipe_select_factors(5) %>%
pipe_bundle_links(field="1. Sex") %>%
pipe_scale_links("link_id",fun = "count") %>%
pipe_label_links("1. Sex",fun = "unique") %>%
pipe_color_links("1. Sex",fun = "unique") %>%
pipe_show_continuity(field="source_id") %>%
make_print_map
ll %>%
pipe_select_factors(5) %>%
pipe_find_links(field = "statement_id",value=90,operator="greater") %>%
pipe_find_links(field = "statement_id",value=290,operator="less") %>%
pipe_bundle_links(field="1. Sex") %>%
pipe_scale_links("link_id",fun = "count") %>%
pipe_label_links("source_id",fun = "unique") %>%
pipe_color_links("1. Sex",fun = "unique") %>%
pipe_show_continuity(field="source_id") %>%
make_print_map
tt %>%
pipe_zoom_factors(1) %>%
pipe_select_factors(5) %>%
make_interactive_map
tt %>%
pipe_zoom_factors(1) %>%
pipe_bundle_links() %>%
pipe_label_links() %>%
pipe_scale_links() %>%
make_print_map
sz %>%
pipe_zoom_factors(1) %>%
pipe_bundle_links(field="simple_bundle") %>%
pipe_label_links(field="source_id",fun = "count") %>%
pipe_label_factors(field="frequency",add_field_name = F) %>%
pipe_wrap_factors() %>%
make_print_map
sz %>%
pipe_zoom_factors(1,preserve_frequency = 4,frequency_field = "frequency",frequency_other = "(other)") %>%
pipe_bundle_links(field="simple_bundle") %>%
pipe_label_factors(field="frequency",add_field_name = F) %>%
pipe_wrap_factors() %>%
make_print_map
oig %>%
pipe_zoom_factors(1,preserve_frequency = 20,frequency_field = "source_count") %>%
pipe_bundle_links(field="simple_bundle") %>%
pipe_label_links(field="source_id",fun = "count") %>%
pipe_label_factors(field="source_count",add_field_name = F) %>%
pipe_color_borders(field="frequency_preserved",lo="white") %>%
pipe_wrap_factors() %>%
make_print_map
tt %>%
pipe_zoom_factors(1,preserve_frequency = 80) %>%
pipe_bundle_links(field="simple_bundle") %>%
pipe_label_links(field="link_id",fun = "count") %>%
pipe_label_factors(field="frequency",add_field_name = F) %>%
pipe_color_borders(field="frequency_preserved",lo="white") %>%
pipe_wrap_factors() %>%
make_print_map
cc %>%
pipe_find_factors(value="Improved health") %>%
pipe_zoom_factors(1) %>%
pipe_select_factors(top=10) %>%
pipe_bundle_links(field="simple_bundle") %>%
pipe_label_links(field="source_id",fun = "count") %>%
pipe_label_factors(field="source_count",add_field_name = F) %>%
pipe_label_factors(field="frequency",add_field_name = F) %>%
pipe_wrap_factors() %>%
make_print_map
cc %>%
pipe_find_factors(value="Improved health") %>%
pipe_zoom_factors(1) %>%
pipe_select_factors(top=10) %>%
pipe_bundle_links(field="simple_bundle") %>%
pipe_label_links(field="source_id",fun = "count") %>%
pipe_label_factors(field="source_count",add_field_name = F) %>%
pipe_label_factors(field="frequency",add_field_name = F) %>%
pipe_wrap_factors() %>%
make_print_map
oi %>%
pipe_find_factors(value="Take a loan") %>%
pipe_zoom_factors(1,preserve_frequency = 2,frequency_other = "(other)") %>%
# pipe_label_factors("source_count") %>%
# pipe_label_links(value="unique:source_id") %>%
make_print_map
hh %>%
make_print_map()
hh %>%
pipe_combine_opposites %>%
pipe_label_links(value="count:link_id") %>%
make_print_map()
# artificial arrowlabels
hh %>%
pipe_combine_opposites %>% pipe_update_mapfile(.,links=.$links %>% mutate(color="limegreen",taillabel=c("","","\u274C","\u274C","","\u274C"),headlabel=c("","","\u274C","\u274C","\u274C","\u274C"))) %>% make_print_map()
hh %>%
pipe_combine_opposites %>% pipe_update_mapfile(.,links=.$links %>% mutate(color="limegreen",taillabel=c("+","+","~","~","+","~"),headlabel=c("+","+","~","~","~","~"))) %>% make_print_map()
hh %>%
pipe_combine_opposites %>% pipe_update_mapfile(.,links=.$links %>% mutate(color="limegreen",arrowtail=c("","","nonetee","nonetee","","nonetee"),arrowhead=c("nonetee","","veenonenonetee","veenonenonetee","veenonenonetee","veenonenonetee"))) %>% make_print_map()
Note colours in Interactive view
tt %>%
pipe_zoom_factors(1) %>%
pipe_combine_opposites() %>%
pipe_select_links(3) %>%
make_print_map
tt %>%
pipe_zoom_factors(1) %>%
pipe_select_links(15) %>%
pipe_combine_opposites() %>%
pipe_bundle_links("flipped_bundle") %>%
pipe_label_links(value="count:link_id") %>%
make_print_map
tt %>%
pipe_zoom_factors(1) %>%
pipe_combine_opposites() %>%
pipe_select_links(3) %>%
make_interactive_map
# factors <- de$factors
de %>%
pipe_color_text(field="time") %>%
make_print_map
Hiding quickfields
de %>%
pipe_hide_quickfields %>%
make_print_map
de %>%
pipe_color_borders(field="happiness") %>%
pipe_label_factors(field = "time") %>%
pipe_hide_quickfields %>%
make_print_map
equivalent:
de %>%
pipe_find_factors(field="time",value="after",up=0,down=0) %>%
make_print_map
de %>%
pipe_find_factors(field="label",value="time:after",up=0,down=0) %>%
make_print_map
zoom
de %>%
pipe_zoom_factors(1) %>%
pipe_color_factors(field="time") %>%
make_print_map
# factors <- de$factors
de %>%
pipe_recalculate_all() %>%
pipe_color_links(field="plausibility") %>%
make_print_map
de %>%
pipe_color_text(field="happiness") %>%
pipe_hide_quickfields %>%
make_print_map
de %>%
pipe_label_factors(field = "time") %>%
pipe_hide_quickfields %>%
make_print_map
cat("### Single\n")
## ### Single
ll %>%
pipe_trace_paths(from = "main_drivers",to="main_outcomes",length = 3) %>%
pipe_select_factors(15) %>%
make_interactive_map
ma %>%
pipe_trace_paths(from = "Shared roles",to="balanced",length = 1) %>%
pipe_select_factors(15) %>%
make_interactive_map
ma %>%
pipe_trace_paths(from = "Covid-19",to="Business",length = 2) %>%
pipe_select_factors(15) %>%
make_interactive_map
oo %>%
pipe_select_factors(15) %>%
pipe_trace_paths(from = "Learnt about farming",to="",length = 5) %>%
make_interactive_map
ee %>%
pipe_trace_paths(from = "Funds",to="area",length = 5) %>%
make_interactive_map
cat("### Case insensitive\n")
## ### Case insensitive
ee %>%
pipe_trace_paths(from = "funds",to="aREa",length = 5) %>%
make_interactive_map
cat("### Failing; no paths at all\n")
## ### Failing; no paths at all
ee %>%
pipe_trace_paths(from = "xx",to="yy",length = 5) %>%
make_interactive_map
cat("### Failing; no paths\n")
## ### Failing; no paths
ee %>%
pipe_trace_paths(from = "Funds",to="yy",length = 5) %>%
make_interactive_map
ee %>%
pipe_trace_paths(from = "xx",to="Property",length = 5) %>%
make_interactive_map
cat("### Implicit multiple\n")
## ### Implicit multiple
ee %>%
pipe_trace_paths(from = "High",to="Damage",length = 5) %>%
make_interactive_map
cat("### Explicit multiple\n")
## ### Explicit multiple
ee %>%
pipe_trace_paths(from = "High",to="Property | Business",length = 5) %>%
make_interactive_map
ee %>%
pipe_trace_paths(from = "High",to="Property OR Business",length = 5) %>%
make_interactive_map
cat("Should this be possible?")
## Should this be possible?
ee %>%
pipe_trace_paths(from = "High",to="Property OR Business",length = 5) %>%
make_interactive_map
tt %>%
pipe_trace_paths(from = "Capabilities",to="[OP3]",length = 2) %>%
make_interactive_map
ee %>%
pipe_trace_paths(from = "Funds",to="area",length = 5) %>%
make_print_map()
## request is large but ok
pa %>%
pipe_trace_paths(from = "",to="~Impact on wellbeing",length = 1) %>%
make_print_map()
pa %>%
pipe_trace_paths(from = "Covid",to="",length = 3) %>%
make_print_map()
## request is large
if(F){e3 %>%
pipe_trace_robustness(from = "High",to="Damage",length = 5) %>%
make_print_map()
ee %>%
pipe_trace_robustness(from = "High",to="Damage",length = 5) %>%
get_robustness()
tt %>%
pipe_trace_robustness(from = "Capabilities",to="[OP3]",length = 2) %>%
pipe_wrap_factors() %>%
make_print_map()
tt %>%
pipe_trace_robustness(from = "Capabilities",to="[OP3",length = 2) %>%
pipe_wrap_factors() %>%
make_print_map()
## checking the robustness gets transferred
tt %>%
pipe_trace_robustness(from = "Capabilities",to="[OP3]",length = 2) %>%
pipe_wrap_factors() %>%
pipe_wrap_links() %>%
pipe_select_links(10) %>%
get_robustness()
tt %>%
pipe_trace_robustness(from = "Capabilities",to="[OP3",length = 2) %>%
get_robustness()
tt %>%
pipe_trace_robustness(from = "Capabilities; [P13",to="[OP3]",length = 2) %>%
get_robustness()
e3 %>%
pipe_trace_robustness(from = "High",to="People moving",length = 5) %>%
make_print_map()
e3 %>%
pipe_trace_robustness(from = "High",to="",length = 5) %>%
make_print_map()
e3 %>%
pipe_trace_robustness(from = "High",to="People moving",length = 5) %>%
get_robustness() %>%
kable
e3 %>%
pipe_trace_robustness(from = "High",to="Flooding",length = 5) %>%
get_robustness() %>%
kable
e3 %>%
pipe_trace_robustness(from = "High",to="Damage",length = 5) %>%
get_robustness() %>%
kable
e3 %>%
pipe_trace_robustness(from = "External",to="Damage",length = 5) %>%
get_robustness() %>%
kable
e3 %>%
pipe_trace_robustness(from = "External",to="Outcome",length = 5) %>%
get_robustness()%>%
kable
}
Just one source:
ee %>%
pipe_trace_robustness(from = "Funds",to="Increased",length = 5,field = "source_id") %>% get_robustness
## rowname Funds from local government
## 1 Increased investment into the area 1
ll %>%
pipe_trace_robustness(from = "Cash",to="Income",length = 5,field="source_id") %>%
get_robustness()
## rowname All origins
## 1 (IEA) Increased income [P] 3
## 2 All targets 1
## 3 (IEA) Reduction in disposable income [N] 1
## 4 (IEA) Increased time on income generation [P] 0
## (IEA) Social Cash Transfer (Gov) [I] (IEA) Social Cash Transfer (OrgX) [E]
## 1 16 3
## 2 2 0
## 3 1 1
## 4 0 0
## (IEA) Social Cash Transfer not working (Gov)
## 1 0
## 2 0
## 3 0
## 4 0
Check that opposites colouring is always preserved?
if(F){
hh %>%
pipe_trace_robustness(from = "Revision",to="happy",length = 5) %>%
pipe_combine_opposites %>%
make_print_map()
hh %>%
pipe_combine_opposites %>%
pipe_find_factors(value="exam") %>%
make_print_map()
hh %>%
pipe_combine_opposites %>%
pipe_zoom_factors() %>%
pipe_find_factors(value="exam") %>%
pipe_select_factors(2) %>%
pipe_select_links(3) %>%
make_print_map()
}
Colours in interactive map
hh %>%
pipe_combine_opposites %>%
pipe_zoom_factors() %>%
make_interactive_map()
e3 %>%
pipe_trace_paths(from = "rainfall",to="",length = 4) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_label_links(field = "source_id",fun = "literal",clear_previous = F) %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_borders(field="n_downstream_threads_surviving") %>%
make_print_map()
e3 %>%
pipe_trace_paths(from = "rainfall",to="",length = 4) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "downstream_threads",fun = "literal") %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_borders(field="n_downstream_threads_surviving") %>%
make_print_map()
e3 %>%
pipe_trace_paths(from = "rainfall",to="",length = 4) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "downstream_threads",fun = "count") %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_borders(field="n_downstream_threads_surviving") %>%
make_print_map()
# with multiple origins
e3 %>%
pipe_trace_paths(from = "External",to="",length = 2) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_factors(field="found_type") %>%
pipe_color_borders(field="n_downstream_threads_surviving") %>%
make_print_map()
ll %>%
pipe_trace_paths(from = "OrgX",to="Income",length = 4) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
make_print_map()
# works also with other fields
ll %>%
pipe_trace_paths(from = "OrgX",to="Income",length = 4) %>%
pipe_trace_threads(field="r.2. Village") %>%
# pipe_bundle_links(field="r.2. Village") %>%
pipe_label_links(field = "downstream_threads",fun = "unique") %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
make_print_map()
# with no target
ll %>%
pipe_trace_paths(from = "OrgX",to="",length = 2) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
make_print_map()
ll %>%
pipe_trace_paths(from = "doesnotexist",to="Income",length = 4) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
make_print_map()
## NULL
ll %>%
pipe_trace_paths(from = "OrgX",to="doesnotexist",length = 4) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
make_print_map()
## NULL
oo %>%
pipe_select_factors(15) %>%
pipe_trace_paths(from = "Learnt about farming",to="",length = 5) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
make_print_map
oo %>%
pipe_select_factors(10) %>%
pipe_trace_paths(from = "Learnt about farming",to="Health",length = 3) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_label_links(field = "source_id",fun = "count",clear_previous = F) %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_factors(field="found_type") %>%
make_print_map
# note that sum of has_downstream_threads can be more than number of unique sources
oo %>%
pipe_select_factors(10) %>%
pipe_trace_paths(from = "Learnt about farming",to="Health",length = 3) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
# pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
# pipe_label_links(field = "continuation_id",fun = "count",clear_previous = F) %>%
pipe_label_links(field = "downstream_threads",fun = "unique",clear_previous = F) %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_factors(field="found_type") %>%
pipe_wrap_links() %>%
make_print_map
oi %>%
# pipe_select_factors(20) %>%
pipe_trace_paths(from = "Take a loan",to="",length = 4) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_label_links(field = "source_id",fun = "count",clear_previous = F) %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_factors(field="found_type") %>%
make_print_map
oi %>%
# pipe_select_factors(20) %>%
pipe_trace_paths(from = "Need more",to="",length = 2) %>%
pipe_trace_threads() %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_label_links(field = "source_id",fun = "count",clear_previous = F) %>%
pipe_label_links(field = "source_id",fun = "literal",clear_previous = F) %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_factors(field="found_type") %>%
make_print_map
# kb <- load_mapfile("kenya-beka")
#
# kb %>%
# pipe_trace_paths(from = "Covid-19",to="~Performance",length = 3) %>%
# pipe_trace_threads() %>%
# pipe_bundle_links() %>%
# pipe_label_links(field = "downstream_threads",fun = "initials") %>%
# make_print_map
e3 %>%
pipe_trace_paths(from = "",to="Outcome",length = 4) %>%
pipe_trace_threads(direction="up") %>%
pipe_bundle_links() %>%
pipe_label_links(field = "source_id",fun = "literal") %>%
pipe_label_links(field = "has_upstream_threads",fun = "sum",clear_previous = F) %>%
pipe_color_links(field = "has_upstream_threads",fun = "sum") %>%
pipe_color_borders(field="n_upstream_threads_surviving") %>%
pipe_label_factors(field="n_upstream_threads_surviving") %>%
make_print_map()
oi %>%
pipe_trace_paths(from = "Flee",to="",length = 3) %>%
pipe_trace_threads(direction="down") %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_label_links(field = "source_id",fun = "literal",clear_previous = F) %>%
pipe_color_links(field = "has_downstream_threads",fun = "sum") %>%
pipe_color_factors(field="found_type") %>%
make_print_map
oi %>%
pipe_trace_paths(from = "",to="Financial diary",length = 2) %>%
pipe_trace_threads(direction="up") %>%
pipe_bundle_links() %>%
pipe_label_links(field = "has_upstream_threads",fun = "sum") %>%
pipe_label_links(field = "source_id",fun = "literal",clear_previous = F) %>%
pipe_color_links(field = "has_upstream_threads",fun = "sum") %>%
pipe_color_factors(field="found_type") %>%
make_print_map
if(F){
graf <- tt1
graf$factors %>% filter(factor_id %notin% graf$links$from & factor_id %notin% graf$links$to) %>% nrow
graf$links %>% filter(from %notin% graf$factors$factor_id & to %notin% graf$factors$factor_id) %>% nrow
graf$links %>% filter(statement_id %notin% graf$statements$statement_id) %>% nrow
}
ee %>%
pipe_coerce_mapfile %>%
pipe_cluster_factors("Damage OR Flood") %>%
make_print_map
Pipe-able:
ee %>%
pipe_cluster_factors("Damage OR Flood") %>%
pipe_cluster_factors("Rising") %>%
make_print_map
cm <-
load_mapfile("cmi-gender")
library("tictoc")
tic()
make_interactive_map(cm)
toc()
## 1.13 sec elapsed
One column in one table
ll %>%
pipe_find_factors(value="economic") %>%
.$factors %>%
.$label %>%
knitr::kable()
| x |
|---|
|
| (IEA) Poverty |
| (BF) Started, expanded or invested in business [P] |
| (BF) Stopped/reduced piece work ‘ganyu’ [P] |
| (IEA) Increased income [P] |
| (IEA) Increased purchasing power [P] |
| (IEA) Increased savings/loans [P] |
| (IEA) Increased financial knowledge [P] |
| (RW) Improved gender equality in household [P] |
| (IEA) Increased economic independence [P] |
| (IEA) No longer borrows from community members [P] |
| (RW) Increased resilience [P] |
|
| (RW) Reduction in household size |
| (RW) Moved to live with relative |
if(T)merge_mapfile(ee,tt %>% pipe_select_factors(top=8)) %>%
pipe_color_factors(field="map_id") %>%
pipe_color_links(field="map_id",fun="unique") %>%
make_interactive_map
Note warning if factor labels are shared
if(T)load_mapfile("example2") %>%
pipe_coerce_mapfile %>%
pipe_merge_mapfile("example2") %>%
pipe_color_factors(field="map_id") %>%
pipe_color_links(field="map_id",fun="unique") %>%
make_interactive_map
There is no guarantee that the resulting map is still a standard mapfile.
ee$factors$label[1] <- "Label changed"
ee %>% make_interactive_map
There is no guarantee that the resulting map is still a standard mapfile.
ee %>%
pipe_update_mapfile(factors = ee$factors %>% mutate(label="one")) %>%
make_interactive_map
# example2 %>%
# pipe_coerce_mapfile %>%
# pipe_find_links(field = "link_id",value=1) %>%
# pipe_select_factors(20) %>%
# pipe_remove_isolated() %>%
# pipe_select_links(20) %>%
# pipe_zoom_factors() %>%
# pipe_find_statements(field = "text",value="Flo") %>%
# pipe_find_factors(value="Flo") %>%
# pipe_remove_brackets("[") %>%
# pipe_trace_robustness(from = "Flood",to="Damage") %>%
# pipe_trace_paths(from = "Flood",to="Damage") %>%
# pipe_combine_opposites() %>%
# pipe_bundle_links() %>%
# pipe_label_links() %>%
# attr("info") %>%
# str
#
# example2 %>%
# pipe_coerce_mapfile() %>%
# pipe_bundle_links() %>%
# pipe_scale_links() %>%
# pipe_label_links() %>%
# pipe_color_links() %>%
# pipe_scale_factors(field = "frequency") %>%
# pipe_label_factors() %>%
# pipe_color_factors() %>%
# pipe_color_borders() %>%
# pipe_mark_links() %>%
# pipe_show_continuity() %>%
# pipe_cluster_factors() %>%
# pipe_wrap_factors() %>%
# pipe_wrap_links() %>%
# print_filter()
You can also load up an Excel file:
# system.file("extdata", "quip-lorem", package = "CausalMapFunctions") %>%
# get_mapfile_from_excel()